package com.zpf.feign;

import com.zpf.entity.User;
import org.springframework.stereotype.Component;

/**
 * @ClassName: UserFeignCustomClientFallback
 * @Description: Hystrix 客户端回退机制类
 * @Autor: ZPF
 * @Date: 2021/1/15 9:37
 **/
@Component
public class UserFeignCustomClientFallback implements UserFeignCustomClient {
    /***
     * @MethodName: findById
     * @Description: Fallback 回退降级的方法，返回一个默认的用户信息
     * @Author: ZPF
     * @Date: 2021/1/15 9:38
     **/
    @Override
    public User findById(Long id) {
        System.out.println("== findById Fallback " + Thread.currentThread().getThreadGroup() + " - " + Thread.currentThread().getId() + " - " + Thread.currentThread().getName());

        User tmpUser = new User();
        tmpUser.setId(0L);
        return tmpUser;
    }
}
